
/*
'===============================================================================
'  Generated From - DAAB_DAL_NET2_Inherited.vbgen
'  It is based on the DAAB from the November 2005 Enterprise Library
'  
'  This object inherits properties, members and methods from the base class _Venue_DAL.
' 
'  Use this class file for writing custom DAL methods. 
'  
'  Version: 1.0
'  Date:	30/01/06
'  Summary: Defaul constructor.
'===============================================================================
*/
using System;
using System.Data;
using System.Data.Common;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;

namespace PlacementManager.DAL
{
    public class Venue_DAL : _Venue_DAL
    {
        //Constructor
        public Venue_DAL()
        {

        }

        /// <summary>
        /// Purpose: Select method. This method will Select all rows from the database, based on the ParentVenueId.
        /// </summary>
        /// <returns></returns>
        public DataSet SelectAllWParentVenueId(int parentVenueId)
        {
            // Create the Database object, using the default database service. The
            // default database service is determined through configuration.
            Database db = DatabaseFactory.CreateDatabase("PlacementManager");

            string sqlCommand = "pr_Venue_DAL_SelectAllWParentVenueId";
            DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "ParentVenueId", DbType.Int32, parentVenueId);

            db.AddOutParameter(dbCommand, "ErrorCode", DbType.Int32, 4);

            DataSet dsToReturn = null;
            dsToReturn = db.ExecuteDataSet(dbCommand);
            return dsToReturn;
        }

        /// <summary>
        /// Purpose: Select method. This method will Select all rows from the database, based on the ParentVenueId.
        /// </summary>
        /// <returns></returns>
        public DataSet SelectOneWVenueName(string venueName)
        {
            // Create the Database object, using the default database service. The
            // default database service is determined through configuration.
            Database db = DatabaseFactory.CreateDatabase("PlacementManager");

            string sqlCommand = "pr_Venue_DAL_SelectOneWVenueName";
            DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "VenueName", DbType.AnsiString, venueName);
            db.AddOutParameter(dbCommand, "ErrorCode", DbType.Int32, 4);

            DataSet dsToReturn = null;
            dsToReturn = db.ExecuteDataSet(dbCommand);
            return dsToReturn;
        }

        /// <summary>
        /// Purpose: Select method for a prefix. This method will Select one or more rows from the database, based on a prefix.
        /// </summary>
        /// <returns></returns>
        public DataSet SelectAllActiveStartingWith(string prefix)
        {
            // Create the Database object, using the default database service. The
            // default database service is determined through configuration.
            Database db = DatabaseFactory.CreateDatabase("PlacementManager");
            string sqlCommand = "pr_Venue_DAL_SelectAllActiveStartingWith";
            DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
            db.AddInParameter(dbCommand, "prefix", DbType.AnsiString, prefix);
            db.AddInParameter(dbCommand, "ErrorCode", DbType.Int32, null);
            DataSet dsToReturn = null;
            dsToReturn = db.ExecuteDataSet(dbCommand);
            return dsToReturn;
        }

        /// <summary>
        /// Purpose: Select all available for a placement type. That is those venues that are 
        /// associated with the unit of the placementtype but haven't been allocated to it yet.
        /// </summary>
        /// <returns></returns>
        public DataSet SelectAllAvailableWPlacementTypeId(int placementTypeId)
        {
            // Create the Database object, using the default database service. The
            // default database service is determined through configuration.
            Database db = DatabaseFactory.CreateDatabase("PlacementManager");

            string sqlCommand = "pr_Venue_DAL_SelectAllAvailableWPlacementTypeId";
            DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "PlacementTypeId", DbType.Int32, placementTypeId);
            db.AddOutParameter(dbCommand, "ErrorCode", DbType.Int32, 4);

            DataSet dsToReturn = null;
            dsToReturn = db.ExecuteDataSet(dbCommand);
            return dsToReturn;
        }

        /// <summary>
        /// Purpose: Select all available for a placement type. That is those venues that are 
        /// associated with the unit of the placementtype but haven't been allocated to it yet.
        /// </summary>
        /// <returns></returns>
        public DataSet SelectAllAvailableAssocWUnitWPlacementTypeId(int placementTypeId)
        {
            // Create the Database object, using the default database service. The
            // default database service is determined through configuration.
            Database db = DatabaseFactory.CreateDatabase("PlacementManager");

            string sqlCommand = "pr_Venue_DAL_SelectAllAvailableAssocWUnitWPlacementTypeId";
            DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "PlacementTypeId", DbType.Int32, placementTypeId);
            db.AddOutParameter(dbCommand, "ErrorCode", DbType.Int32, 4);

            DataSet dsToReturn = null;
            dsToReturn = db.ExecuteDataSet(dbCommand);
            return dsToReturn;
        }

        /// <summary>
        /// Purpose: Select all available for a placement type. That is those venues that are 
        /// associated with the unit of the placementtype but haven't been allocated to it yet.
        /// </summary>
        /// <returns></returns>
        public DataSet SelectAllAvailableAssocWCategoryWPlacementTypeId(int placementTypeId)
        {
            // Create the Database object, using the default database service. The
            // default database service is determined through configuration.
            Database db = DatabaseFactory.CreateDatabase("PlacementManager");

            string sqlCommand = "pr_Venue_DAL_SelectAllAvailableAssocWCategoryWPlacementTypeId";
            DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "PlacementTypeId", DbType.Int32, placementTypeId);
            db.AddOutParameter(dbCommand, "ErrorCode", DbType.Int32, 4);

            DataSet dsToReturn = null;
            dsToReturn = db.ExecuteDataSet(dbCommand);
            return dsToReturn;
        }

        /// <summary>
        /// Purpose: Select all available for a placement type. That is those venues that are 
        /// associated with the unit of the placementtype but haven't been allocated to it yet.
        /// </summary>
        /// <returns></returns>
        public DataSet SelectAllActiveWithoutAddress()
        {
            // Create the Database object, using the default database service. The
            // default database service is determined through configuration.
            Database db = DatabaseFactory.CreateDatabase("PlacementManager");

            string sqlCommand = "pr_Venue_DAL_SelectAllActiveWithoutAddress";
            DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

            db.AddOutParameter(dbCommand, "ErrorCode", DbType.Int32, 4);

            DataSet dsToReturn = null;
            dsToReturn = db.ExecuteDataSet(dbCommand);
            return dsToReturn;
        }

        /// <summary>
        /// Purpose: Select all available for a placement type. That is those venues that are 
        /// associated with the unit of the placementtype but haven't been allocated to it yet.
        /// </summary>
        /// <returns></returns>
        public DataSet SelectAllActiveWithoutTelephone()
        {
            // Create the Database object, using the default database service. The
            // default database service is determined through configuration.
            Database db = DatabaseFactory.CreateDatabase("PlacementManager");

            string sqlCommand = "pr_Venue_DAL_SelectAllActiveWithoutTelephone";
            DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

            db.AddOutParameter(dbCommand, "ErrorCode", DbType.Int32, 4);

            DataSet dsToReturn = null;
            dsToReturn = db.ExecuteDataSet(dbCommand);
            return dsToReturn;
        }

        /// <summary>
        /// Purpose: Select all available for a placement type. That is those venues that are 
        /// associated with the unit of the placementtype but haven't been allocated to it yet.
        /// </summary>
        /// <returns></returns>
        public DataSet SelectAllActiveWithoutCategory()
        {
            // Create the Database object, using the default database service. The
            // default database service is determined through configuration.
            Database db = DatabaseFactory.CreateDatabase("PlacementManager");

            string sqlCommand = "pr_Venue_DAL_SelectAllActiveWithoutCategory";
            DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

            db.AddOutParameter(dbCommand, "ErrorCode", DbType.Int32, 4);

            DataSet dsToReturn = null;
            dsToReturn = db.ExecuteDataSet(dbCommand);
            return dsToReturn;
        }

        /// <summary>
        /// Purpose: Select all available for a placement type. That is those venues that are 
        /// associated with the unit of the placementtype but haven't been allocated to it yet.
        /// </summary>
        /// <returns></returns>
        public DataSet SelectAllActiveWithoutUnit()
        {
            // Create the Database object, using the default database service. The
            // default database service is determined through configuration.
            Database db = DatabaseFactory.CreateDatabase("PlacementManager");

            string sqlCommand = "pr_Venue_DAL_SelectAllActiveWithoutUnit";
            DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

            db.AddOutParameter(dbCommand, "ErrorCode", DbType.Int32, 4);

            DataSet dsToReturn = null;
            dsToReturn = db.ExecuteDataSet(dbCommand);
            return dsToReturn;
        }

        /// <summary>
        /// Purpose: Select all available for a placement type. That is those venues that are 
        /// associated with the unit of the placementtype but haven't been allocated to it yet.
        /// </summary>
        /// <returns></returns>
        public DataSet SelectAllAvailableAssocWUnitWCampusWPlacementTypeId(int placementTypeId)
        {
            // Create the Database object, using the default database service. The
            // default database service is determined through configuration.
            Database db = DatabaseFactory.CreateDatabase("PlacementManager");

            string sqlCommand = "pr_Venue_DAL_SelectAllAvailableAssocWUnitWCampusWPlacementTypeId";
            DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "PlacementTypeId", DbType.Int32, placementTypeId);
            db.AddOutParameter(dbCommand, "ErrorCode", DbType.Int32, 4);

            DataSet dsToReturn = null;
            dsToReturn = db.ExecuteDataSet(dbCommand);
            return dsToReturn;
        }

        /// <summary>
        /// Purpose: Select all available for a placement type. That is those venues that are 
        /// associated with the unit of the placementtype but haven't been allocated to it yet.
        /// </summary>
        /// <returns></returns>
        public DataTable SelectAllActiveAndContactDetailsAndAddressWCampusId(int campusId)
        {
            // Create the Database object, using the default database service. The
            // default database service is determined through configuration.
            Database db = DatabaseFactory.CreateDatabase("PlacementManager");

            string sqlCommand = "pr_Venue_DAL_SelectAllActiveAndContactDetailsAndAddressWCampusId";
            DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "CampusId", DbType.Int32, campusId);
            db.AddOutParameter(dbCommand, "ErrorCode", DbType.Int32, 4);

            DataSet ds = null;
            ds = db.ExecuteDataSet(dbCommand);
            DataTable dtToReturn = ds.Tables[0];
            return dtToReturn;
        }

	}


}
